<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DataListUpdateData.aspx.cs" Inherits="DataListUpdateData" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>DataList Demo</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <p>DataList Control</p>
        <asp:DataList ID="dtlCategories" runat="server" OnEditCommand="dtlCategories_EditCommand" DataKeyField="CategoryID" OnCancelCommand="dtlCategories_CancelCommand" OnUpdateCommand="dtlCategories_UpdateCommand" OnDeleteCommand="dtlCategories_DeleteCommand" RepeatColumns="2">
           <HeaderTemplate>
                <div style="float:left;width:960px;">
           </HeaderTemplate>  
           <ItemTemplate>
                <div style="border:solid 2px red;width:300px; padding:5px; margin:5px; float:left;">
                    <p>CategoryID: <%#Eval("CategoryID") %></p>
                    <p>CategoryName: <%#Eval("CategoryName")%></p>
                    <p>Description: <%#Eval("Description")%></p>
                    <asp:LinkButton CommandName="Edit" ID="lbtnEdit" Text="Edit" runat="server"></asp:LinkButton>
                    <asp:LinkButton CommandName="Delete" ID="lbtnDelete" Text="Delete" runat="server"></asp:LinkButton>
               </div>
           </ItemTemplate>  
           <EditItemTemplate>
                <div style="border:solid 2px blue;width:300px;  padding:5px; margin:5px;float:left;">
                    <p>CategoryID: <asp:TextBox ID="txtCategoryID" ReadOnly="true" Text='<%#Eval("CategoryID") %>' runat="server"></asp:TextBox></p>
                    <p>CategoryName: <asp:TextBox ID="txtCategoryName" Text='<%#Eval("CategoryName")%>' runat="server"></asp:TextBox></p>
                    <p>Description: <asp:TextBox ID="txtDescription" Text='<%#Eval("Description")%>' runat="server"></asp:TextBox></p>
                    <asp:LinkButton CommandName="Update" ID="lbtnUpdate" Text="Update" runat="server"></asp:LinkButton>
                    <asp:LinkButton CommandName="Cancel" ID="lbtnCancel" Text="Cancel" runat="server"></asp:LinkButton>
                    <asp:LinkButton CommandName="Delete" ID="lbtnDelete" Text="Delete" runat="server"></asp:LinkButton>
               </div>
           </EditItemTemplate>
           <FooterTemplate>
                </div>
           </FooterTemplate>
        </asp:DataList>
    </div>
    </form>
</body>
</html>

